<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="customersList.do"/>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<SCRIPT language="JavaScript">
	function searchCustomer(theForm)
	{
	    theForm.action.value = "SearchCustomer";
	    //theForm.submit();
        return true;
	}

function getNewSalesRep(salesRepValue) {

  if (salesRepValue.value == -2) {
      newWindow = window.open ('<%=chipTracContext%>/addRepOffice.do','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=no,width=400,height=200,resizable=no');
      if(!newWindow.opener) {newWindow.opener = window}
     newWindow.focus();
  }
}
// SharatH on July 31, 2003
function showErrorReportPage()
{
    newWindow = window.open ('<%=chipTracContext%>/reportProblem.do','reportProblem','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=750,height=400,resizable=no');
    newWindow.focus();
}
   //Added by Sarada on 7th Jan 2004
   function openCustomer()
    {
        //newWindow =
        window.open('customers.do?action=PrintCustomer&customerId=<%=(String)request.getAttribute("customerId")%>&shipMethod1=<%=request.getParameter("shipMethod1")%>&shipMethod2=<%=request.getParameter("shipMethod2")%>&shipMethod3=<%=request.getParameter("shipMethod3")%>','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=600,height=600,left=100,top=50,resizable=yes');
        //newWindow.moveTo(100,50);
        //newWindow.focus();
    }
</SCRIPT>
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
<!-- Side Navigation start -->
	<%@ include file="/jsp/sales/sales_menu.jsp" %>
</TD>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->
<html:form name="customers_list" method="post" action="/customersList" scope="request" type="com.scalar.chiptrack.sales.forms.CustomerListForm" onsubmit="javascript:return searchCustomer(document.customers_list);">
<center><span class="NArialW">Customer Details</span></center>
<table border="0" width="90%" align=right>
<tr><td colspan =7 align="left" class='NArialL'><font styleClass="NArialL" id="message1" color="green">&nbsp;</font></td></tr>
<tr><td colspan =7 align="left" class='NArialL'><font styleClass="NArialL" id="message2" color="FF0000">&nbsp;</font></td></tr>
<tr><td colspan =7 class="NArialL"><chiptrack:info styleClass="NArialL" /></td></tr>
<tr><td colspan =7 class="NArialL"><chiptrack:errors styleClass="NArialL" /></td></tr>
 <tr><td>
  <table border="0" width="100%" align=right>
  <!--tr><td colspan=5--><!--chiptrack:errors styleClass="NArialL" /></td></tr-->
  <tr>
      <td width="15%"><font class="NArialL">Customer</font></td>
      <td width="20%"><font class="NArialL">
      	<html:text property="customerName" styleClass="txfield" size="23" />
      </td>
      <td width="5%">&nbsp;</td>
      <td width="15%" class="NArialL">Customer Type</td>
      <td width="20%">
        <html:select name="customerListForm" property="customerType" styleClass="txfield">
            <html:option value="">--Select--</html:option>
            <html:options collection="customerTypes" property="value" labelProperty="label"/>
        </html:select>
      </td>
    </tr>
	<tr>
      <td width="15%" class="NArialL">Region</td>
      <td width="20%" class="NArialL">
      	<html:select name="customerListForm" property="region" styleClass="txfield">
        <html:option value="">--Select--</html:option>
	    <html:options name="regions" />
        </html:select>
      </td>
      <td width="5%">&nbsp;</td>
      <td width="15%" class="NArialL">Regional Rep</td>
      <td width="20%" class="NArialL">

	  <html:select name="customerListForm" property="repOffice" styleClass="txfield" >
	  <html:option value="">--Select--</html:option>
      <!--<html:option value="-2" >--- Add New Rep.Office --</html:option>-->
      <html:options name="repOffices" />
      </html:select>
      </td>
    </tr>
    <tr>
      <td colspan=5 align="left" class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;
      </td>
    </tr>
  <%--<tr>
      <td colspan=1 align="center" class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;
          <a class="leftsection" href='<%=chipTracContext + "/customersList.do?action=updatenewCustomers"%>' onmouseover="window.status='Click to Update new Customers Details';return true" onmouseout="window.status='';return true">
          Update New Customers</a>
      </td>
      <td colspan=4>&nbsp;</td>
    </tr>--%>
    <tr>
     <td colspan=5 align=center>
           <input type=image border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to search for Customers';return true" onmouseout="window.status='';return true" title="Click here to Search for Customer"><%--</a> --%> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <a href="javascript:document.customers_list.reset();" onmouseover="window.status='Click to reset ';return true" onmouseout="window.status='';return true" title="Click here to Reset"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17"></a>
      </td>
    </tr>

 </table>

  </td></tr>
  <tr><td><img height=10 src="images/spacer.gif"></td></tr>
  <tr><td>

      <table border="0" width="100%" bordercolor="#FFFFFF" align=right>

            <tr><td class="NArialL" colspan=5>To add a new customer, please
            <chiptrack:restrictedLink functionality='<%=Functionality.CUSTOMER_DETAILS%>' action='<%=User.USER_ACTION_VIEW%>' styleClass="leftsection" href='<%=chipTracContext + "/customers.do?action=CreateCustomer"%>' onmouseover="window.status='Click to Enter a new Customer';return true" onmouseout="window.status='';return true">click here</chiptrack:restrictedLink></td></tr>
  	   
		<% String value =(String)request.getAttribute ("ShowTable");
		 String action = request.getParameter("action");
		String value1 =(String)request.getAttribute ("AllEmpty");
		%>

		<% if("GetAllCustomers".equals(action) && ("TRUE".equals(value)) ) {%>
             <tr>
               <td width="25%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Customer Name</font></td>
               <td width="20%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Contact Person</font></td>
               <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Region</font></td>
               <td width="35%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Actions</font></td>
               <td width="5%" align="center">&nbsp;</td>
             </tr>
			 <% }

			 if("SearchCustomer".equals(action) && ("FALSE".equals(value1)) ){ %>
			<tr>
               <td width="25%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Customer Name</font></td>
               <td width="20%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Contact Person</font></td>
               <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Region</font></td>
               <td width="35%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Actions</font></td>
               <td width="5%" align="center">&nbsp;</td>
             </tr>
		<% } else {%> <TR></tr><% }%>


          <% int bgcount = 0;%>
  	  <logic:iterate id="Customer" name="customerslist">
           <% bgcount = bgcount + 1; %>
  	    <tr>
  	     <td width="25%" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL">
  	     	<bean:write name="Customer" property="customerName" /></font></td>
  	     <td width="20%" <%if(bgcount%2==0) {%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL">
  	     	 <logic:notEqual name="Customer" property="contactPerson" value="-1">
			<bean:write name="Customer" property="contactPerson" />
			 </logic:notEqual>
			</font></td>
  	     <td width="15%" <%if(bgcount%2==0) {%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL">
  	     	<bean:write name="Customer" property="region" /></font></td>
  	     <td width="35%" align="center" <%if(bgcount%2==0) {%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL">
                <logic:equal name="showModify" value="TRUE">
                    <chiptrack:linkCustomer page="/customers.do?action=EditCustomer"  onmouseover="window.status='Click to Edit Customer Details';return true" onmouseout="window.status='';return true">Edit</chiptrack:linkCustomer>
  		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </logic:equal>
                <logic:equal name="showDelete" value="TRUE">
                    <!-- Commented by Sarada on 3rd July 2003 -->
                    <!--chiptrack:linkCustomer page="/customersList.do?action=DeleteCustomer">Delete< /chiptrack:linkCustomer-->
                    <chiptrack:linkCustomer page="/customers.do?action=ViewCustomer&flag=True" onmouseover="window.status='Click to Delete Customer Details';return true" onmouseout="window.status='';return true">Delete</chiptrack:linkCustomer>

  		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </logic:equal>
                <chiptrack:linkCustomer page="/customers.do?action=ViewCustomer"  onmouseover="window.status='Click to View Customer Details';return true" onmouseout="window.status='';return true">View</chiptrack:linkCustomer>

  		</font>
  	      </td>
  	     </tr>
  	  </logic:iterate>

      </table>

  </td></tr>
</table>

<input type="hidden" name="action" value="" >
<input type="hidden" name="shipMethod1" value="<%=request.getParameter("shipMethod1")%>"/>

</html:form>

<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->

<%@ include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->
<%
    String value = (String)request.getAttribute("Confirm");
    String quotValue = (String)request.getAttribute("Confirmquote");

if( "DELETE".equalsIgnoreCase(value) == true) {
%>
<script language="javascript">

var pa1 = document.getElementById("message1");
var htmltext1  = "<li> Customer deleted successfully ";
pa1.insertAdjacentHTML('BeforeEnd',htmltext1);
</script>
<% }
else
if( ("DONTDELETE".equalsIgnoreCase(value) == true) && ("DONTDELETEQUOTE".equalsIgnoreCase(quotValue) == false) )
{
%>
<script language="javascript">
var pa2 = document.getElementById("message2");
var htmltext2  = "<li> The Customer cannot be deleted since a SalesOrder is generated against the Customer";
pa2.insertAdjacentHTML('BeforeEnd',htmltext2);
</script>
<% }
else
if( ("DONTDELETE".equalsIgnoreCase(value) == false) && ("DONTDELETEQUOTE".equalsIgnoreCase(quotValue) == true) )
{
%>
<script language="javascript">
var pa2 = document.getElementById("message2");
var htmltext2  = "<li> The Customer cannot be deleted since a Qutation is generated against the Customer";
pa2.insertAdjacentHTML('BeforeEnd',htmltext2);
</script>
<% }
else
if( ("DONTDELETE".equalsIgnoreCase(value) == true) && ("DONTDELETEQUOTE".equalsIgnoreCase(quotValue) == true) )
{
%>
<script language="javascript">
var pa2 = document.getElementById("message2");
var htmltext2  = "<li> The Customer cannot be deleted since SalesOrder and Qutation are generated against the Customer";
pa2.insertAdjacentHTML('BeforeEnd',htmltext2);
</script>
<% }%>



</BODY>
</HTML>
